package com.example.mostra_orario;

import java.util.Calendar;
import java.util.GregorianCalendar;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class MostraOrarioActivity extends Activity {
    /** Called when the activity is first created. */
	
	Button b;
	TextView tv;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        b = (Button) findViewById(R.id.trigger);
        tv = (TextView) findViewById(R.id.text);
        
        b.setOnClickListener(new OnClickListener(){
			public void onClick(View v) {
				aggiornaOrario();
			}	
        });
        
    }
    
    private void aggiornaOrario(){
    	GregorianCalendar gc = new GregorianCalendar();
		String time = gc.get(Calendar.HOUR) + ":" + gc.get(Calendar.MINUTE) + "," + gc.get(Calendar.SECOND);
		tv.setText(R.string.introduci_orario);
		tv.setText(tv.getText() + " " + time);
		b.setText(R.string.aggiorna_orario);
    }
    
    
}